package com.financing.common;
import com.financing.model.system.Param;
import com.financing.util.Str;
import com.jfinal.core.JFinal;

public class CONST { 
	
	/** SYS CONFIG PARAMS */ 
	public final static String PLAT = "未了财富"; 
	public final static String COMPANY = "象山未了达信网络科技有限公司";
	public final static String PLAT_CODE = "QHDQTZ001k";
	public final static String SUCCESS = "success";
	public final static String ERROR = "error";   
	public final static String URL = "https://www.wlcfull.com"; 
	public final static String ROOT = "/opt/apache-tomcat-9.0.7/webapps/ROOT";   
	public final static String MIDDLE_ACCOUNT = "18267462921"; 
	public final static String COUPON_ACCOUNT = "13685727575"; 
	// 融资机构余额不足提醒手机号 原：15268422398
	public final static String DEBT_MOBILE = "15268422398";  
	// 系统创建日期  
	public final static String FOUNDING = "2018-06-01 00:00:00";   
	//注意: 这里的password(秘钥必须是16位的) 
	public static final String AES_KEY = "wlcf_pretty_good"; 
	
	/** UMENG API KEY */
	public static final String iosPushAppkey = "5a30a00cf43e482e690001a8";
	public static final String iosPushMasterSecret = "1v7juqlqh0ekcqhb1rv3twm5hhimcfyn";
	public static final String androidPushAppkey = "5a3093bef29d980fea00025a";
	public static final String androidPushMasterSecret = "r6d0occnee1dnrqolmvub72kjqjdtny5";
	
	/** EMAIL CONFIG PARAMS */    
	public final static String EMAIL_SERVER = "smtp.qq.com";           
	public final static String EMAIL_LOGIN_ACCOUNT = "3263876057@qq.com";
	public final static String EMAIL_LOGIN_AUTH_CODE = "xlxyamhbcvxldafb"; 
	public final static String EMAIL_SENDER = "3263876057@qq.com";
	
	public static void setAttr(String key, String val){
		JFinal.me().getServletContext().setAttribute(key, val);
	}
	 
	public static String getAttr(String key){
		Object s = JFinal.me().getServletContext().getAttribute(key);
		return s!=null ? s.toString() : "";
	}
	
	public static String find(String name){
		if(Str.isBlank(CONST.getAttr(name))){
			Param pm = Param.me.findFirst("select * from param where name=?",name);
			CONST.setAttr(name, pm.getValue());		
		}		
		return CONST.getAttr(name);
	}
	
	public static void removeAttr(String key){
		JFinal.me().getServletContext().removeAttribute(key);
	}
}    